﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SGCG
{
    public static class UserMessage
    {

        public static UserControl MainPage { get; set; }

        public static bool IsDebugEnabled { get; set; }

        public static void ClearStatus()
        {
            Status("");
        }

        public static void Status(string statusText)
        {
            (MainPage.FindName("StatusBarText") as TextBlock).Text = statusText;
        }

        public static void Debug(string message)
        {
            if (IsDebugEnabled)
            {
                FrameworkElement debugControl = MainPage.FindName("DebugControl") as FrameworkElement;
                if (debugControl == null)
                    return;
                StackPanel debugPanel = debugControl.FindName("DebugPanel") as StackPanel;
                if (debugPanel == null)
                    return;
                UIElementCollection messages = debugPanel.Children;
                messages.Add(new TextBlock() { Text = message });
            }
        }

        private static int drawCount = 0;
        public static void LogDraw()
        {
            if (IsDebugEnabled)
            {
                ++drawCount;
                Debug("Draw count: " + drawCount);
            }
        }

    }
}
